#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>

/*
 * ./second_drv
 */

int main(int argc, char **argv)
{
	int fd;
	unsigned char keyvals[4];
	int cnt = 0;
	fd = open("/dev/second_drv", O_RDWR);
	if(fd < 0)
	{
		printf("Can't open /dev/second_drv\n\r");
		return -1;
	}

	while(1)
	{
		read(fd, keyvals, sizeof(keyvals));
		if(!keyvals[0] || !keyvals[1] || !keyvals[2] || !keyvals[3])
		{
			printf("keyval: %d %d %d %d\n\r", cnt++, keyvals[0], keyvals[1], keyvals[2], keyvals[3]);
		}
	}
	return 0;
}


